$(document).ready(function() {
						   
	//clear adds
	$('iframe,object,embed,input[type=image],ins').hide();

	$("div,table").live('mouseover mouseout click', function(e) {
		
		// on mouseover set red border
		if (e.type == 'mouseover') {
		$(this).css({"border":"1px solid red"});
		} else {
		$("div,table").css({"border":"none"});
		}
		
		if (e.type == 'click') {
			
		// remove the main css and javascript
		$("link[type='text/css'],link[rel='stylesheet'],script,style,noscript").remove();
		
		// remove content from <body>
		$("body").empty();
		
		// insert only the selection
		$(this).appendTo("body");
		
		//take the text from the <title>
		var title = $('title').text();
		
		// empty the <head>
		$("head").empty();
		
		//append the Title
		$("head").append("<title>" +title+ "</title>");
		
		// set printing css style
		$("head").append('<style type="text/css">@media print{div,table {width:100% !important;font-family:Garamond,"Times New Roman",serif !important;font-size:12pt !important;}}</style>');
		
		// append the title to the bottom of the page
		$(this).append("<hr><b>From The Web Page</b>: <i>" +title+ "</i>"); 
		
		
		// set css style
		$(this).css({"font":"21px/1.618 Georgia, serif","color":"#111","width":"62%","margin":"5px auto"});
		$("a img").css({"border":"0"});
		$("p").css({"margin":"0.618em 0"});
		$("h1,h2,h3,br").css({"line-height":"1.3"});
		$("body").css({"background-color":"#f9f9f9"});
		
		// kill all events
		$("div,table").die("mouseover mouseout click");
		
		}return false;
		
	});

});